<?php /*

GALLERY NODE SETUP INSTRUCTIONS

This file creates a simple photo gallery with Drupal, complete with a nice teaser image. All
of the modules mentioned below are a part of Drupal Acquia.

To implement a gallery type complete the following steps:

0 	- 	enable Lightbox2 + CCK + Filefield + Imagefield + ImageAPI + ImageCache + ImageCache UI + ImageAPI GD2 modules
1	-	create an imagecache preset called "gallerythumb"

		0	-	Click Add Scale => set width to 120, leave height blank
		1	-	Click New Actions => Add Crop => set width/height to 90 and both offsets to center
		2	-	Click Save Preset
		3	-	Edit site permissions so anonymouse users can "view imagecache gallerythumb"
		
2	-	create an imagecache preset called "lightbox"

		0	-	Click Add Scale => set width to 420, leave height blank
		1	-	Click Save Preset
		2	-	Edit site permissions so anonymouse users can "view imagecache lightbox"

3 	- 	create a new content type called 'gallery'
4 	- 	in your new gallery content type, add a repeating file/imagefield called 
		galleryimage (refered to in the template below as field_galleryimage)
		
		
Tutorials Referenced --

Lightbox2 - Custom integration with CCK Imagefield and Imagecache
http://drupal.org/node/274487

Image and Image Exact Sizes vs. Imagefield and ImageCache
http://www.lullabot.com/articles/image_and_image_exact_sizes_vs_imagefield_and_imagecache
		
*/ ?>


<?php if ($teaser): ?>

	<div class="ListingTeaser Gallery">
		<div class="TeaserText">
			<div class="TeaserTitle">
				<h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
				  <?php if ($submitted): ?>
				    <span class="Submitted"><?php print $submitted; ?></span>
				  <?php endif; ?>
			</div>
			<div class="TeaserBody">
				<div class="TeaserImage">
					<a href="<?php print $node_url ?>" title="<?php print $title ?>">
						<?php print theme('imagecache', 'gallerythumb', $field_galleryimage[0]['filepath']); ?>
					</a>
				</div>
				<div class="TeaserText">		
					<?php print $node->content['body']['#value'] ?>
				</div>
			</div>
			<div class="clear-block clear"></div>
			<div class="more-link">
				<a href="<?php print $node_url ?>" title="<?php print $title ?>">Read More</a>
			</div>
			<div class="clear-block clear"></div>
		</div>
	</div>

	<div class="clear-block clear"></div>

<?php else: ?>

<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?>">

<?php print $picture ?>

<?php if ($page == 0): ?>
	<h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>

		<div class="Content Gallery">
		
			<div class="Description">
				<?php print $node->content['body']['#value'] ?>
				<div class="ImageCount">
					<?php echo count($field_galleryimage) ?> Images
				</div>
			</div>
			
			<div class="ImageGallery">
				<?php if (content_format('field_galleryimage', $field_galleryimage[0]) != '') : ?>
					<?php
					    foreach((array)$node->field_galleryimage as $item) {
					        echo "\n";
					        print ('<div class="GalleryThumbnail">');
					        $item['lightbox_preset'] = 'lightbox';
					        print theme('imagefield_image_imagecache_lightbox2', 'gallerythumb', 'field_galleryimage', $item, $node, $rel = 'lightbox');
					        print ('</div>');
					    }
					?>
				<?php endif; ?>
				<div class="clear-block clear"></div>
			</div><!-- end "ImageGallery" div -->
			
			<div class="clear-block">
				<div class="Meta">
				<?php if ($taxonomy): ?>
				  <div class="Terms"><?php print $terms ?></div>
				<?php endif;?>
				</div>
			
				<?php if ($links): ?>
				  <div class="Links"><?php print $links; ?></div>
				<?php endif; ?>
			</div>
			
			<div class="clear-block clear"></div>

		</div>

</div>

<?php endif; ?>